classdef PIDController < EquipmentControl.FeedBackOptimization.LTIUnit.AbstractLTIUnit
    %PIDCONTROLLER Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
        p
        i
        d
    end
    
    methods
        function obj = PIDController(pVal, iVal, dVal, varargin)
            %PIDCONTROLLER Construct an instance of this class
            %   Detailed explanation goes here
            p=inputParser;
            p.addParameter('name', 'pid', @ischar);
            p.addParameter('Tf', 0.0, @(x) isnumeric(x) && x > 0);
            p.parse(varargin{:});
            
            Tf = p.Results.Tf;
            num = [dVal+pVal*Tf pVal+iVal*Tf iVal];
            den = [Tf 1 0];            
            obj@EquipmentControl.FeedBackOptimization.LTIUnit.AbstractLTIUnit(p.Results.name, num, den);
            
            obj.p = pVal; obj.i = iVal; obj.d = dVal;
        end
        
        function [pval, ival, dval] = getPIDValues(obj)
            pval = obj.p; ival = obj.i; dval = obj.d;
        end
    end
end

